import { View } from "../../../../mvc/core/View";
import { Language } from "../../../../../extend/language/Language";
import { ImagesConst } from "../../../resource/ImagesConst";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { EffectManager } from "../../../manager/EffectManager";
import { ObjCreate } from "../../common/ObjCreate";
import { GImageBitmap } from "../../../../../com/mui/controls/GImageBitmap";
import { Cache } from "../../../cache/Cache";
import { PetProcessBar } from "../../pet/PetProcessBar";
type int = number;
//class MountFosterAttrView
    
    export  class MountFosterAttrView extends View
    {
        constructor(arg1: Boolean)
        {
            super();
            this._sArray = Language.getString(70143).split(",");
            this._barClass = [ImagesConst.YellowBar10, ImagesConst.GreenBar10, ImagesConst.BlueBar10];
            this._valueTxtArray = [];
            this._barArray = [];
            this._raiseArray = [];
            this._isReplace = arg1;
            this.init();
            return;
        }

        public updateValue(arg1: Array<any>, arg2: int): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=0;
            var loc4=0;
            while (loc4 < this._valueTxtArray.length) 
            {
                loc1 = this._valueTxtArray[loc4];
                loc2 = this._barArray[loc4];
                loc3 = arg1[loc4];
                loc1.text = loc3.toString();
                loc2.setValue(loc3, arg2);
                ++loc4;
            }
            return;
        }

        public updateAddValue(arg1: Array<any>, arg2: Boolean=false): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=null;
            var loc4=0;
            var loc5=0;
            while (loc5 < this._valueTxtArray.length) 
            {
                loc3 = this._raiseArray[loc5];
                if ((loc4 = arg1[loc5]) > 0) 
                {
                    loc3.bitmapData = GlobalClass.getBitmapData(ImagesConst.RangeRaise);
                }
                else if (loc4 != 0) 
                {
                    if (loc4 < 0) 
                    {
                        loc3.bitmapData = GlobalClass.getBitmapData(ImagesConst.RangeDecline);
                    }
                }
                else 
                {
                    loc3.bitmapData = GlobalClass.getBitmapData(ImagesConst.RangeSame);
                }
                if (arg2) 
                {
                    EffectManager.glowFilterReg(loc3);
                }
                else 
                {
                    EffectManager.glowFilterUnReg(loc3);
                }
                ++loc5;
            }
            return;
        }

        public move(arg1: int, arg2: int): void
        {
            this.x = arg1;
            this.y = arg2;
            return;
        }

        public clear(): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=null;
            var loc4=0;
            var loc5=0;
            while (loc5 < this._valueTxtArray.length) 
            {
                loc1 = this._valueTxtArray[loc5];
                loc2 = this._barArray[loc5];
                loc3 = this._raiseArray[loc5];
                loc1.text = "";
                loc2.setValue(0, 0);
                loc3.bitmapData = null;
                ++loc5;
            }
            return;
        }

        /* internal  */init(): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=null;
            var loc4=null;
            if (this._isReplace) 
            {
                ObjCreate.createBg(0, 0, 188, 120, this);
                addChild(new GImageBitmap("EquipRecast_new.png", -1, -1));
            }
            else 
            {
                ObjCreate.createBg(0, 0, 165, 120, this);
                addChild(new GImageBitmap("EquipRecast_current.png", -1, -1));
            }
            if (Cache.instance.role.isPhysicalCareer) 
            {
                this._labelArray = [this._sArray[0], this._sArray[1], this._sArray[2]];
            }
            else 
            {
                this._labelArray = [this._sArray[3], this._sArray[4], this._sArray[2]];
            }
            var loc5=0;
            while (loc5 < this._labelArray.length) 
            {
                loc1 = ObjCreate.createGTextField(this._labelArray[loc5] + "：", 0, loc5 * 25 + 47, 34, 20, this);
                loc1.autoSize = flash.text.TextFieldAutoSize.LEFT;
                loc2 = ObjCreate.createGTextField(this._labelArray[loc5] + "：", loc1.width, loc5 * 25 + 47, 34, 20, this);
                loc2.autoSize = flash.text.TextFieldAutoSize.LEFT;
                loc3 = new PetProcessBar(this._barClass[loc5], 85, 12);
                loc3.move(75, loc5 * 25 + 51);
                addChild(loc3);
                loc4 = ObjCreate.createBitmap(ImagesConst.RangeRaise, 165, loc5 * 25 + 47, this);
                this._valueTxtArray.push(loc2);
                this._barArray.push(loc3);
                this._raiseArray.push(loc4);
                ++loc5;
            }
            return;
        }

        /* internal */ /* var */_sArray: Array<any>;

        /* internal */ /* var */_barClass: Array<any>;

        /* internal */ /* var */_labelArray: Array<any>;

        /* internal */ /* var */_isReplace: Boolean;

        /* internal */ /* var */_valueTxtArray: Array<any>;

        /* internal */ /* var */_barArray: Array<any>;

        /* internal */ /* var */_raiseArray: Array<any>;
    }
